package homework.polywork.testing;

import homework.polywork.coding.Animal;
import homework.polywork.coding.Cat;
import homework.polywork.coding.Dog;
import homework.polywork.coding.Sheep;

import java.util.Random;

public class Test {
    public static void main(String[] args) {

        Animal[] array=new Animal[5];
        Random r = new Random();
        for (int i=0;i<array.length;i++){

            int ran1 = r.nextInt(3);
            System.out.println(ran1);
            if (ran1==0){
                Animal one=new Cat("cat");
                array[i]=one;
            }
            else if( ran1==1){
                Animal two=new Sheep("sheep");
                array[i]=two;
            }
            else {
                Animal thr=new Dog("dog");
                array[i]=thr;
            }
        }

        for(Animal obj : array){
            obj.cry();
        }

    }
}
